﻿using Framework;
using System.Runtime.Serialization;
using System.Xml;

namespace SchemaMonitor.xml
{
    [DataContract]
    [KnownType(typeof(CVCard))]
    public class CImg
    {
        [DataMember(Order = 1)]  public string Name;
        [DataMember(Order = 2)]  public byte[] Data;

        private CImg() { }
        public CImg(XmlNode i)
        {
            Name = CXml.AttributeStr(i, "name");
            if (string.IsNullOrEmpty(Name) || "null" == Name)
                Name = CXml.AttributeStr(i, "cl");
            Data = CBinary.FromBase64(CXml.AttributeStr(i, "data"));
        }
    }
}
